// ==================================================================================
// Shared Genomics Project MPI Codebase
// Version 1.0 30/04/2010
//
// (c) 2010 University of Manchester all rights reserved
//
// This file is distributed under the GNU General Public License, Version 2.  
// Please see the file COPYING.txt for more details
// ==================================================================================

/*!
\file 
\brief Header File for the Fast Epistasis (BT) Association Function
*/
#ifndef _FAST_PEPI_BT_ASSOC_H_
#define _FAST_PEPI_BT_ASSOC_H_

#include "bitstring.h"
#include "bmapfile.h"
#include "sample.h"
#include "types.h"

#ifdef __cplusplus
extern "C" {
#endif

/*! \brief A default Z-score of the calculation */
#define JUNK_Z (double) -9

/*! 
\ingroup fast_pepi_bt
\brief Association function for fast epistasis (BT)
\details
	Calculates the association between 2 SNPs.
	The data is SNP major and this function returns a Z-score.

\param [in] e1 index of 1st SNP (current SNP)
\param [in] bs1 BitString containing allelic data of 1st SNP
\param [in] e2 index of 2nd SNP
\param [in] bs2 BitString containing allelic data of 2nd SNP
\param [in] samples Data-set %sample array (people and phenotypes)
\param [in] nSamples Size of the %sample array
\param [in, out] summary_sig Integer array storing the No. valid interactions for SNP with other members of a data-set.
\param [in, out] summary_good Denotes if the current interactions is significant, i.e. greater than the specified p-value threshold.
\param [in, out] best_partner Index array denoting a SNPs best partner in a data-set.
\param [in, out] best_score A double array storing the value of the test statistic associated with the current SNP interaction.
\param [in] epi_alpha2 Epistasis threshold for significance counting.
\param [in, out] is_valid Boolean array to identify that the current interaction is valid
\returns double or \ref JUNK_Z if calculation went mental.
*/
double fast_pepi_assoc(int e1, BitString bs1, int e2, BitString bs2, struct sample *samples, int nSamples, int *summary_sig, int *summary_good, int *best_partner, double *best_score, double epi_alpha2, BOOL *is_valid);

#ifdef __cplusplus
}
#endif

#endif // _FAST_PEPI_BT_ASSOC_H_
